"""
 encoding    : utf-8
 @File       : interface.py
 @Author     : qin
 @Version    :
 @Description:
 @Date       : 2024/07/15
"""
import requests


class InterFace:
    def __init__(self,url):
        self.url = url

    def request_post(self,data,headers=None):
        self.result = requests.post(url=self.url,data=data,headers=headers)

    def request_get(self,params,headers=None):
        self.result = requests.get(url=self.url,params=params,headers=headers)

    def request_json_post(self,json,headers=None):
        self.result = requests.post(url=self.url,json=json,headers=headers)

    def get_response_headers(self):
        return self.result.headers

    def get_response_body(self):
        return self.result.text

    def get_response_json(self):
        return self.result.json()

    def close_link(self):
        self.result.close()
